﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Collections;

namespace Functionality
{
    [DebuggerDisplay("{FullName}")]
    public class Person
    {
        public Person()
        {
            PrizesWon = new List<Prize>();
        }

        public Person(string name) : this()
        {
            FirstName = PersonHelper.ParseFirstName(name);
            LastName = PersonHelper.ParseLastName(name);
        }
        
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string FullName { get { return FirstName + " " + LastName; } }
        public List<Prize> PrizesWon { get; private set; }
    }

    public class PersonCompare : IEqualityComparer<Person>
    {
        public bool Equals(Person x, Person y)
        {
            return x.FullName == y.FullName;
        }

        public int GetHashCode(Person obj)
        {
            return obj.FullName.GetHashCode();
        }
    }
}
